<%@ page language="java" contentType="text/html; charset=UTF-8"	 pageEncoding="UTF-8"%>
<%@ include file="../include/laypublic.jsp"%>
<!DOCTYPE html>
<html>
<head>
  <title>业务操作日志</title>
  <style type="text/css">
  	.layui-form-select dl{
		max-height: 150px; // 原值为300，调节高度建议为50的倍数
	}
  </style>
</head>
<body>
  <div class="layui-fluid">   
    <div class="layui-card">
      <!-- 查询区域  -->
      <div id="query-form" class="layui-form layui-card-header layuiadmin-card-header-auto">
        <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label">用户名</label>
            <div class="layui-input-inline">
              <input type="text" name="susername" placeholder="请输入" autocomplete="off" class="layui-input">
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">真实姓名</label>
            <div class="layui-input-inline">
              <input type="text" name="srealName" placeholder="请输入" autocomplete="off" class="layui-input">
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">日志模块</label>
            <div class="layui-input-inline">
              	<infopub:select entireName="-日志模块" id="query-form-itype" name="itype" type="dic" groupNo="A00001026">
				</infopub:select>
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">日志动作</label>
            <div class="layui-input-inline">
              	<infopub:select entireName="-日志动作" id="query-form-saction" name="saction" type="dic" groupNo="A00001027">
				</infopub:select>
            </div>
          </div>
          <div class="layui-inline">
             <label class="layui-form-label">操作时间</label>
             <div class="layui-input-inline">
               <input type="text" class="layui-input" id="sent-laydate-start" readonly name="startDate" placeholder="开始日期">
             </div>
             <div class="layui-form-mid">
               -
             </div>
             <div class="layui-input-inline">
               <input type="text" class="layui-input" id="sent-laydate-end" readonly name="endDate" placeholder="结束日期">
             </div>
          </div>
          <shiro:hasPermission name="LIST_BIZLOG">
	          <div class="layui-inline">
	            <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="LAY-visit-log-search">
	              <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>查询
	            </button>
	            <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="LAY-user-back-reset">
	              <i class="layui-icon layui-icon-fonts-clear  layuiadmin-button-btn"></i>重置
	            </button>
	          </div>
          </shiro:hasPermission>
        </div>
      </div>
      <div class="layui-card-body">
      	<!-- 数据表单 -->
        <table id="LAY-visit-log-manage" lay-filter="LAY-visit-log-manage"></table>
      </div>
    </div>
  </div>

  <script>
	//json 
	var itypeJSON = <infopub:dicJson groupNo="A00001026" />;
	var sactionJSON = <infopub:dicJson groupNo="A00001027" />;
  	layui.config({
    	base: '${ctx}/resources/layuiadmin/' //静态资源所在路径
  	}).extend({
    	index: 'lib/index' //主入口模块
  	}).use(['index', 'table', 'laydate'], function(){
    	var $ = layui.$
    	,form = layui.form
    	,table = layui.table
    	,laydate = layui.laydate;
    
    	//开始日期
    	var insStart = laydate.render({
      		elem: '#sent-laydate-start'
      		,done: function(value, date){
	        	//更新结束日期的最小日期
	        	insEnd.config.min = lay.extend({}, date, {
	          		month: date.month - 1
	        	});
	       		//自动弹出结束日期的选择器
	       		insEnd.config.elem[0].focus();
      		}
    	});
    
    	//结束日期
    	var insEnd = laydate.render({
      		elem: '#sent-laydate-end'
      		,done: function(value, date){
        		//更新开始日期的最大日期
        		insStart.config.max = lay.extend({}, date, {
          			month: date.month - 1
        		});
      		}
    	});
    	// 表单
    	table.render({
      		elem: '#LAY-visit-log-manage'
      		,url: basePath + '/sysBizlog/queryDataByCondition' //请求数据接口
      		,cols: [[
        		{type: 'checkbox', fixed: 'left'}
        		,{field: 'susername', title: '用户名'}
        		,{field: 'srealName', title: '真实姓名'}
        		,{field: 'sip', title: '访问IP'}
        		,{field: 'toperateDate', title: '操作时间', templet: function(d){
      		  			return layui.util.toDateString(d.toperateDate,"yyyy-MM-dd HH:mm:ss");
        			}
        		}
        		,{field: 'scontent', title: '操作内容'}
        		,{field: 'itype', title: '日志模块', templet: function(d){
        				return itypeJSON[d.itype];
        			}
        		}
        		,{field: 'saction', title: '日志动作', templet: function(d){
        				return sactionJSON[d.saction];
        			}
        		}
        		,{field: 'sremark', title: '备注'}
      		]]
      		,page: true
      		,limit: 10
    	});
    
    	<shiro:hasPermission name="LIST_BIZLOG">
		    //监听搜索
		    form.on('submit(LAY-visit-log-search)', function(data){
		      	//执行重载
		      	table.reload('LAY-visit-log-manage', {page: {curr: 1},
		        	where: trimData(data)
		      	});
		    });
			//重置清空
		    form.on('submit(LAY-user-back-reset)', function(data){
		    	reset_form('query-form');
		    	//额外处理select
				$("#query-form-itype").val('');
				$("#query-form-saction").val('');
		    });
	    </shiro:hasPermission>
  });
  </script>
</body>
</html>

